home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / equipchk.zip / EQUIPCHK.PAS < prev   
Pascal/Delphi Source File  |  1990-07-31  |  3KB  |  91 lines

  1. Program EquipmentCheck;
  2. {
  3. ______________________________________________________________________________
  4. Checking for various peripheral devices attatched to the PC.
  5. ______________________________________________________________________________
  6. }
  7. type
  8.  RegSet = record
  9.            Case integer of
  10.              1: (AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags : integer);
  11.              2: (AL,AH, BL,BH, CL,CH, DL,DH : byte);
  12.           end;
  13.  
  14. var
  15.    Devices, Memory,
  16.    Printers, DiskDrives,
  17.    RS232, GameIO, M8087 : integer;
  18.    Monitor : string[20];
  19.  
  20. Function AvailMem : integer;
  21. {returns available memory in Kbytes}
  22. var
  23.   Regs : RegSet;
  24. begin
  25.   Intr($12, Regs);       {calling interupt service 12H}
  26.   AvailMem := Regs.AX;   {equipment status returned in AX}
  27. end;
  28.  
  29. Function EquipStat : integer;
  30. {returns the equipment status byte}
  31. var
  32.    Regs : RegSet;
  33. begin
  34.    Intr($11, Regs);      {calling interupt service 11H}
  35.    EquipStat := Regs.AX; {returning equipment status in AX}
  36. end;
  37.  
  38. Function DispType : integer;
  39. {returns type of display monitor attatched}
  40. var
  41.    Regs : RegSet;
  42. begin
  43.    Regs.Ah := $0f;
  44.    Intr($10, Regs);      {calling interupt service 10H}
  45.    DispType := Regs.AL;  {display type in the AL register}
  46. end;
  47.  
  48. Procedure GetEquipStat;
  49. {evaluates the equipment status bytes for specific attatchments}
  50. begin
  51.      Memory      :=   AvailMem;
  52.      Devices     :=   EquipStat;
  53.      Printers    :=   (Devices AND $C000) SHR 14;
  54.      DiskDrives  :=   ((Devices AND $00C0) SHR 6) + 1;
  55.      RS232       :=   (Devices AND $0E00) SHR 9;
  56.      GameIO     :=   (Devices AND $0002) SHR 1;
  57.      Case DispType of
  58.         2 : Monitor  :=  'Composite Color';
  59.         3 : Monitor  :=  'RGB Color';
  60.         7 : Monitor  :=  'Monochrome';
  61.      end;
  62. end;
  63.  
  64. Procedure DispEquipStat;
  65. {Displays result of Equipment checks}
  66. begin
  67.    WriteLn('Equipment Check reveals the following devices:');
  68.    WriteLn;
  69.    WriteLn('System Memory:              ',Memory,'k');
  70.    WriteLn('5 1/4" Disk Drives:         ',DiskDrives);
  71.    WriteLn('Parallel Printer Adapters:  ',printers);
  72.    WriteLn('RS-232 Serial Adapters:     ',RS232);
  73.    WriteLn(Monitor,'Display Monitor');
  74.    If GameIO = 1 then
  75.    WriteLn('Game Adapter Port:       ',GameIO)
  76.    else
  77.    WriteLn('No Game Adapter Port');
  78.    If M8087 = 1 then
  79.    WriteLn('8087 Math CoProcessor')
  80.    else
  81.    WriteLn('No Math Coprocessor');
  82. end;
  83.  
  84.  
  85. { ** main program begins here **}
  86.  
  87. begin
  88.   GetEquipStat;
  89.   DispEquipStat;
  90. end.
  91.